package P150;

/**
 * @author LiangMu
 * @version \$Id: P26.java, v 0.1, 2024年07月05日 15:11 LiangMu Exp $$
 */
public class P26 {

    public static int maxArea(int[] height) {
        int left = 0, right = height.length - 1;
        int res = 0;
        while (left < right) {
            int area = (right - left) * Math.min(height[left], height[right]);
            res = Math.max(area, res);
            if (height[right] > height[left]) {
                ++left;
            } else {
                --right;
            }
        }
        return res;
    }

    public static void main(String[] args) {
        int[] ints = {1,1};
        System.out.println(maxArea(ints));
    }
}
